﻿package org.dm.3d.Actions.object 
{
	import org.dm.3d.Actions.Action;
	import flash.geom.Vector3D;
	import org.dm.3d.geom.MathExtend;
	/**
	 * ...
	 * @author Scott
	 */
	public class Eiffel extends Action
	{
		private var goalPos:Array;
		private var goalNum:uint;
		private var _init:Boolean = false;
		private var _pre:Boolean = true;
		private var _root:Boolean = false;
		private var _cur:uint = 0;
		private var _speed:uint = 30;
		
		public function Eiffel() 
		{
			this.isUsed = true;
			goalPos = new Array();
			var points:Vector.<Number> = Vector.<Number>([-4.818268,2.380666,2.173783
,-4.818268,1.438629,2.173783
,-4.818268,-0.503231,2.173783
,-4.818268,-2.445090,2.173783
,-4.818268,-3.387128,2.173783
,-3.366572,2.135655,2.173783
,-3.366572,0.816212,2.173783
,-3.366572,-0.503231,2.173783
,-3.366572,-1.822673,2.173783
,-3.366572,-3.142116,2.173783
,-3.366572,2.135655,0.888346
,-3.366572,1.484525,1.539435
,-3.366572,-0.503231,1.539435
,-3.366572,-2.490986,1.539435
,-3.366572,-3.142116,0.888346
,-3.366572,2.135655,-0.397091
,-3.366572,1.484525,-0.397091
,-3.366572,-2.490986,-0.397091
,-3.366572,-3.142116,-0.397091
,-3.366572,2.135655,-1.682529
,-3.366572,1.484525,-2.333617
,-3.366572,-0.503231,-2.333617
,-3.366572,-2.490986,-2.333617
,-3.366572,-3.142116,-1.682529
,-3.366572,2.135655,-2.967965
,-3.366572,0.816212,-2.967965
,-3.366572,-0.503231,-2.967965
,-3.366572,-1.822673,-2.967965
,-3.366572,-3.142116,-2.967965
,-4.818268,2.380666,-2.967965
,-4.818268,1.199634,-2.967965
,-4.818268,-0.503231,-2.967965
,-4.818268,-2.206095,-2.967965
,-4.818268,-3.387128,-2.967965
,-4.818268,2.380666,-2.293559
,-4.818268,-0.503231,-1.659266
,-4.818268,-3.387128,-2.139880
,-4.818268,2.380666,-0.397091
,-4.818268,0.938718,-0.397091
,-4.818268,-0.503231,-0.397091
,-4.818268,-1.945179,-0.397091
,-4.818268,-3.387128,-0.397091
,-4.818268,2.380666,1.499377
,-4.818268,-0.503231,0.865083
,-4.818268,-3.387128,1.345698
,0.001344,0.816212,0.888346
,0.001344,-0.503231,0.609835
,0.001344,0.816212,-0.397091
,0.001344,-1.822673,0.888348
,0.001344,-1.822673,-0.397091
,0.001344,-0.503231,-1.404017
,0.001344,0.816212,-1.682529
,0.001344,-1.822673,-1.682531
,-2.478592,1.284996,1.345048
,-2.478592,1.284996,-2.139231
,-2.478592,-2.291457,-2.139231
,-2.478592,-2.291457,1.345050
,0.487040,0.816212,0.888346
,0.487041,0.816212,-0.397091
,0.487040,-1.822673,0.888348
,0.487041,-1.822673,-0.397091
,0.487041,0.816212,-1.682529
,0.487041,-1.822673,-1.682531
,0.001344,1.143524,1.215659
,0.032743,-0.503230,1.292128
,0.455642,-0.503230,1.292128
,0.487040,1.143524,1.215659
,0.032743,1.215598,-0.397091
,0.455642,1.215598,-0.397091
,0.001344,-2.149985,1.215660
,0.487040,-2.149985,1.215660
,0.032743,-2.222059,-0.397091
,0.455642,-2.222059,-0.397091
,0.001344,1.143524,-2.009841
,0.032743,-0.503230,-2.086312
,0.487041,1.143524,-2.009841
,0.455642,-0.503230,-2.086312
,0.001344,-2.149986,-2.009843
,0.487041,-2.149985,-2.009843
,0.487040,0.816212,0.888346
,0.487041,-0.503231,0.900348
,0.487041,0.816212,-0.397091
,0.487040,-1.822673,0.888348
,0.487041,-1.822673,-0.397091
,0.487041,-0.503231,-1.694530
,0.487041,0.816212,-1.682529
,0.487041,-1.822673,-1.682531
,10.525678,-0.096533,0.050995
,10.525680,-0.503231,0.050995
,10.525680,-0.096533,-0.397091
,10.525678,-0.909929,0.050995
,10.525680,-0.909929,-0.397091
,10.525680,-0.503231,-0.845176
,10.525680,-0.096533,-0.845176
,10.525680,-0.909928,-0.845177
,1.153619,-1.585856,0.649988
,1.153619,-0.503231,0.649986
,1.153619,0.579395,0.649986
,1.153619,0.579395,-0.397091
,1.153619,0.579395,-1.444168
,1.153619,-0.503231,-1.444168
,1.153619,-1.585856,-1.444169
,1.153619,-1.585856,-0.397091
,1.753179,-1.412820,0.605063
,1.753179,-0.503231,0.605061
,1.753179,0.406358,0.605061
,1.753179,0.406358,-0.397091
,1.753179,0.406358,-1.399244
,1.753179,-0.503231,-1.399244
,1.753179,-1.412819,-1.399246
,1.753179,-1.412820,-0.397091
,2.364971,-1.320625,0.503486
,2.364972,-0.503231,0.503484
,2.364971,0.314164,0.503484
,2.364972,0.314164,-0.397091
,2.364972,0.314164,-1.297667
,2.364972,-0.503231,-1.297667
,2.364972,-1.320625,-1.297668
,2.364972,-1.320625,-0.397091
,3.025697,-1.224525,0.397606
,3.025697,-0.503231,0.397605
,3.025697,0.218064,0.397605
,3.025697,0.218064,-0.397091
,3.025697,0.218064,-1.191787
,3.025697,-0.503231,-1.191787
,3.025697,-1.224525,-1.191789
,3.025697,-1.224525,-0.397091
,3.759730,-1.168828,0.336241
,3.759731,-0.503231,0.336240
,3.759730,0.162367,0.336240
,3.759731,0.162367,-0.397091
,3.759731,0.162367,-1.130423
,3.759731,-0.503231,-1.130423
,3.759731,-1.168828,-1.130424
,3.759731,-1.168828,-0.397091
,4.506057,-1.081670,0.240213
,4.506058,-0.503231,0.240212
,4.506057,0.075208,0.240212
,4.506058,0.075208,-0.397091
,4.506058,0.075208,-1.034395
,4.506058,-0.503231,-1.034395
,4.506058,-1.081669,-1.034396
,4.506058,-1.081670,-0.397091
,5.154475,-1.032533,0.186076
,5.154476,-0.503231,0.186075
,5.154475,0.026071,0.186075
,5.154476,0.026071,-0.397091
,5.154476,0.026071,-0.980257
,5.154476,-0.503231,-0.980257
,5.154476,-1.032533,-0.980258
,5.154476,-1.032533,-0.397091
,5.974215,-0.976508,0.124349
,5.974217,-0.503231,0.124348
,5.974215,-0.029954,0.124348
,5.974217,-0.029954,-0.397091
,5.974217,-0.029954,-0.918531
,5.974217,-0.503231,-0.918531
,5.974217,-0.976507,-0.918532
,5.974217,-0.976508,-0.397091
,6.769430,-0.924410,0.066950
,6.769431,-0.503231,0.066949
,6.769430,-0.082051,0.066949
,6.769431,-0.082051,-0.397091
,6.769431,-0.082051,-0.861132
,6.769431,-0.503231,-0.861132
,6.769431,-0.924410,-0.861132
,6.769431,-0.924410,-0.397091
,7.454636,-0.872447,0.009699
,7.454637,-0.503231,0.009698
,7.454636,-0.134015,0.009698
,7.454637,-0.134015,-0.397091
,7.454637,-0.134015,-0.803880
,7.454637,-0.503231,-0.803880
,7.454637,-0.872446,-0.803880
,7.454637,-0.872447,-0.397091
,8.237662,-0.813064,-0.055727
,8.237664,-0.503231,-0.055727
,8.237662,-0.193397,-0.055727
,8.237664,-0.193397,-0.397091
,8.237664,-0.193397,-0.738455
,8.237664,-0.503231,-0.738455
,8.237664,-0.813064,-0.738455
,8.237664,-0.813064,-0.397091
,9.094099,-0.764069,-0.109708
,9.094105,-0.503231,-0.109709
,9.094099,-0.242392,-0.109709
,9.094105,-0.242392,-0.397091
,9.094105,-0.242392,-0.684473
,9.094105,-0.503231,-0.684473
,9.094105,-0.764069,-0.684473
,9.094105,-0.764069,-0.397091
,9.779246,-0.712082,-0.166987
,9.779246,-0.503231,-0.166987
,9.779246,-0.294380,-0.166987
,9.779246,-0.294380,-0.397091
,9.779246,-0.294380,-0.627196
,9.779246,-0.503231,-0.627196
,9.779246,-0.712081,-0.627196
,9.779246,-0.712082,-0.397091
,-7.539663,4.233111,-4.954652
,-7.539663,3.671501,-4.954652
,-7.539663,3.671501,-4.658044
,-7.539663,4.233111,-4.369938
,-7.539663,2.565857,-4.954652
,-7.539663,2.565857,-4.627861
,-7.539663,3.671501,-3.718235
,-7.539663,4.233111,-3.718237
,-7.539663,2.565857,-3.718235
,-7.518337,-3.500022,-4.954652
,-7.518337,-4.605667,-4.954652
,-7.518337,-4.605667,-4.658044
,-7.518337,-3.500022,-4.627861
,-7.518338,-5.167277,-4.954652
,-7.518337,-5.167277,-4.419474
,-7.518337,-4.605667,-3.718235
,-7.518336,-3.500022,-3.718235
,-7.518337,-5.167277,-3.718237
,-7.540045,4.219292,3.027403
,-7.540045,3.654585,3.027402
,-7.540045,3.654584,3.967211
,-7.540045,4.219293,3.679105
,-7.540045,2.545524,3.027402
,-7.540045,2.545524,3.937028
,-7.540045,3.316407,4.263822
,-7.540045,4.219293,4.263822
,-7.540045,2.545524,4.263822
,-7.559751,-3.480475,2.973169
,-7.559751,-4.589404,2.973167
,-7.559751,-4.589404,3.924685
,-7.559751,-3.480476,3.894502
,-7.559751,-5.153992,2.973172
,-7.559751,-5.153991,3.686116
,-7.559751,-4.251225,4.231047
,-7.559751,-3.480476,4.231046
,-7.559751,-5.153991,4.231046
,-3.801329,-1.822673,-2.967965
,-3.801329,-0.503231,-2.967965
,-3.801329,0.816212,-2.967965
,-3.801329,2.135655,-2.967965
,-3.801329,2.135655,-1.682529
,-3.801329,2.135655,-0.397091
,-3.801329,2.135655,0.888346
,-3.801329,2.135655,2.173783
,-3.801329,0.816212,2.173783
,-3.801329,-0.503231,2.173783
,-3.801329,-1.822673,2.173783
,-3.801329,-3.142116,2.173783
,-3.801329,-3.142116,0.888346
,-3.801329,-3.142116,-0.397091
,-3.801329,-3.142116,-1.682529
,-3.801329,-3.142116,-2.967965
,-3.975857,2.040482,2.042193
,-3.975857,2.040482,1.047017
,-3.975857,2.040482,-0.397091
,-3.975857,2.040482,-1.841200
,-3.975857,2.040482,-2.836375
,-3.975857,0.768625,-2.836375
,-3.975857,-0.503231,-2.836375
,-3.975857,-1.775087,-2.836375
,-3.975857,-3.046943,-2.836375
,-3.975857,-3.046943,-1.616734
,-3.975857,-3.046943,-0.397091
,-3.975857,-3.046943,0.822551
,-3.975857,-3.046943,2.042193
,-3.975857,-1.775087,2.042193
,-3.975857,-0.503231,2.042193
,-3.975857,0.768625,2.042193
,-6.000640,-2.693245,3.061058
,-6.000640,-3.516325,3.061058
,-6.000640,-4.149157,3.061058
,-6.000640,-4.149157,2.511862
,-6.000640,-4.149157,1.848815
,-6.000640,-3.630320,1.848812
,-6.000640,-2.693245,1.848813
,-6.000640,-2.693245,2.639022
,-6.000190,1.750432,3.081375
,-6.000189,1.750432,2.667766
,-6.000189,1.750432,1.900655
,-6.000189,2.667015,1.900655
,-6.000190,3.179083,1.900659
,-6.000190,3.179083,2.536402
,-6.000190,3.179083,3.081375
,-6.000190,2.553019,3.081375
,-6.012646,3.193676,-3.289867
,-6.012646,3.193676,-2.640273
,-6.012646,2.687997,-2.640271
,-6.012646,1.789866,-2.640271
,-6.012646,1.789866,-3.421230
,-6.012646,1.789866,-3.839891
,-6.012646,2.423333,-3.839891
,-6.012646,3.193676,-3.839891
,-6.019844,-3.409732,-3.852074
,-6.019844,-2.777304,-3.852074
,-6.019844,-2.777304,-3.438465
,-6.019843,-2.777304,-2.671355
,-6.019843,-3.674396,-2.671355
,-6.019844,-4.179323,-2.671360
,-6.019844,-4.179323,-3.311306
,-6.019844,-4.179323,-3.852074
,11.306950,-0.096533,0.050995
,11.306952,-0.503231,0.050995
,11.939707,-0.503231,-0.397090
,11.306952,-0.096534,-0.397090
,11.306950,-0.909929,0.050995
,11.306952,-0.909927,-0.397090
,11.306952,-0.503231,-0.845173
,11.306952,-0.096535,-0.845173
,11.306953,-0.909926,-0.845174
,13.613810,-0.505548,-0.355555
,14.436886,-0.513636,-0.355555
,11.964448,-0.505548,-0.390542
,12.787524,-0.513636,-0.390542
,-0.614571,0.932639,-0.397091
,-0.614571,0.932639,-1.795955
,-0.614571,-0.503231,-1.586614
,-0.614571,-1.939100,-1.795956
,-0.614571,-1.939100,-0.397091
,-0.614571,-1.939100,1.001774
,-0.614571,-0.503231,0.792432
,-0.614571,0.932639,1.001772
,-1.035979,1.012298,-1.873561
,-1.035979,-2.018759,-1.873562
,-1.035979,-2.018759,1.079380
,-1.035979,1.012298,1.079378
,-1.557541,1.110889,-1.969611
,-1.557541,-2.117350,-1.969612
,-1.557541,-2.117350,1.175430
,-1.557541,1.110889,1.175429
,-1.994744,1.193534,-2.050126
,-1.994744,-2.199995,-2.050127
,-1.994744,-2.199995,1.255945
,-1.994744,1.193534,1.255943
,-4.427998,1.197737,2.112820
,-4.427998,2.223066,2.112820
,-4.427998,2.223066,1.304371
,-4.427998,2.223066,-0.397091
,-4.427998,2.223066,-2.098554
,-4.427998,2.223066,-2.907003
,-4.427998,0.859918,-2.907003
,-4.427998,-0.503231,-2.907003
,-4.427998,-1.866379,-2.907003
,-4.427998,-3.229527,-2.907003
,-4.427998,-3.229527,-1.883012
,-4.427998,-3.229527,-0.397091
,-4.427998,-3.229527,1.088830
,-4.427998,-3.229527,2.112820
,-4.427998,-2.204198,2.112820
,-4.427998,-0.503231,2.112820
,-5.227387,2.657036,2.487943
,-5.227387,1.871645,2.487943
,-5.227387,0.276868,2.487943
,-5.227387,0.276868,1.489077
,-5.227387,0.276868,0.398267
,-5.227387,1.536963,0.398267
,-5.227387,2.657036,0.398268
,-5.227387,2.657036,1.810841
,-5.229795,-1.265468,2.482600
,-5.229795,-2.866377,2.482600
,-5.229795,-3.652353,2.482600
,-5.229795,-3.652353,1.694263
,-5.229795,-3.652353,0.384599
,-5.229795,-2.531694,0.384598
,-5.229795,-1.265468,0.384598
,-5.229795,-1.265468,1.482505
,-5.599097,0.985637,2.773377
,-5.599096,0.985637,2.056014
,-5.599096,0.985637,1.120900
,-5.599096,2.080506,1.120900
,-5.599097,2.908135,1.120902
,-5.599097,2.908135,2.085651
,-5.599097,2.908135,2.773377
,-5.599097,2.244737,2.773377
,-5.681709,-2.102513,2.821725
,-5.681709,-3.340003,2.821725
,-5.681709,-3.943608,2.821725
,-5.681709,-3.943608,2.190832
,-5.681709,-3.943608,1.243007
,-5.681709,-3.175773,1.243005
,-5.681709,-2.102513,1.243005
,-5.681709,-2.102513,2.160522
,-6.452847,1.984159,3.428968
,-6.452847,1.984159,3.040880
,-6.452847,1.984159,2.231875
,-6.452847,2.957322,2.231875
,-6.452847,3.484864,2.231878
,-6.452847,3.484864,2.861768
,-6.452847,3.484865,3.428968
,-6.452847,2.803043,3.428968
,-7.010712,2.272208,3.857350
,-7.010712,2.272208,3.500713
,-7.010712,2.272208,2.640077
,-7.010712,3.315103,2.640077
,-7.010712,3.861715,2.640079
,-7.010712,3.861716,3.350480
,-7.010712,3.861716,3.857350
,-7.010712,3.066068,3.857350
,-6.437194,-2.913671,3.388657
,-6.437194,-3.744586,3.388657
,-6.437194,-4.430512,3.388657
,-6.437194,-4.430512,2.872226
,-6.437194,-4.430512,2.163637
,-6.437194,-3.898866,2.163634
,-6.437194,-2.913671,2.163635
,-6.437194,-2.913671,2.990559
,-6.997764,-3.196715,3.809320
,-6.997764,-3.994663,3.809320
,-6.997764,-4.791795,3.809320
,-6.997764,-4.791795,3.324059
,-6.997764,-4.791795,2.567893
,-6.997764,-4.243698,2.567889
,-6.997764,-3.196715,2.567891
,-6.997764,-3.196715,3.441960
,-6.613343,3.602568,-3.064322
,-6.613343,3.074887,-3.064320
,-6.613343,2.095125,-3.064320
,-6.613343,2.095125,-3.895894
,-6.613343,2.095125,-4.278416
,-6.613343,2.985686,-4.278416
,-6.613343,3.602568,-4.278416
,-6.613343,3.602568,-3.716511
,-7.019842,3.879271,-3.351281
,-7.019842,3.336701,-3.351279
,-7.019842,2.301698,-3.351279
,-7.019842,2.301698,-4.217105
,-7.019842,2.301698,-4.575171
,-7.019842,3.336701,-4.575171
,-7.019842,3.879271,-4.575171
,-7.019842,3.879271,-4.066863
,-6.940665,-3.221413,-3.314661
,-6.940665,-4.246660,-3.314661
,-6.940666,-4.786419,-3.314664
,-6.940666,-4.786419,-4.051514
,-6.940667,-4.786419,-4.529607
,-6.940666,-4.246660,-4.529607
,-6.940666,-3.221413,-4.529607
,-6.940666,-3.221413,-4.169347
,-6.544155,-3.030178,-3.037651
,-6.544155,-4.000240,-3.037651
,-6.544156,-4.525001,-3.037654
,-6.544156,-4.525001,-3.736102
,-6.544156,-4.525001,-4.237858
,-6.544156,-3.911039,-4.237858
,-6.544156,-3.030178,-4.237858
,-6.544156,-3.030178,-3.854626
,-3.366572,0.500027,1.539435
,-2.478592,0.345596,1.345048
,-1.035979,0.094706,0.981286
,-1.557541,0.185413,1.116120
,-1.994744,0.261448,1.226093
,-0.614571,0.021418,0.868922
,-3.366572,-1.384705,1.539435
,-2.478592,-1.226137,1.345049
,-0.614571,-0.893276,0.849299
,-1.035979,-0.968527,0.967107
,-1.557541,-1.061663,1.107777
,-1.994744,-1.139735,1.221989
,-3.366572,-1.318439,-2.333617
,-2.478592,-1.162658,-2.139231
,-0.614571,-0.837387,-1.635332
,-1.035979,-0.910816,-1.755119
,-1.557541,-1.001791,-1.898122
,-1.994744,-1.078122,-2.014198
,-3.366572,0.379172,-2.333617
,-2.478592,0.233055,-2.139231
,-0.614571,-0.070824,-1.649656
,-1.035979,-0.002291,-1.765099
,-1.557541,0.082679,-1.903719
,-1.994744,0.154013,-2.016835
,-3.366572,1.484525,0.585386
,-3.366572,-2.490986,0.585386
,-2.478592,1.284996,0.405795
,-2.478592,-2.291457,0.405795
,-0.614571,-1.939100,0.028801
,-0.614571,0.932639,0.028802
,-1.035979,-2.018759,0.114030
,-1.035979,1.012298,0.114030
,-1.557541,-2.117350,0.219514
,-1.557541,1.110889,0.219515
,-1.994744,-2.199995,0.307938
,-1.994744,1.193534,0.307938
,-3.366572,1.484525,-1.457033
,-3.366572,-2.490986,-1.457033
,-2.478592,1.284996,-1.279437
,-2.478592,-2.291457,-1.279437
,-0.614571,0.932639,-0.906632
,-0.614571,-1.939100,-0.906632
,-1.035979,1.012298,-0.990914
,-1.035979,-2.018759,-0.990914
,-1.557541,1.110889,-1.095226
,-1.557541,-2.117350,-1.095227
,-1.994744,1.193534,-1.182667
,-1.994744,-2.199995,-1.182667
,-5.234594,2.664058,-1.179001
,-5.234594,1.548467,-1.179000
,-5.234594,0.296078,-1.179000
,-5.234594,0.296078,-2.273437
,-5.234594,0.296078,-3.271894
,-5.234594,1.593726,-3.271894
,-5.234594,2.664058,-3.271894
,-5.234594,2.664058,-2.595224
,-5.686342,2.971562,-2.027436
,-5.686342,2.210094,-2.027435
,-5.686342,1.163393,-2.027435
,-5.686342,1.163393,-2.939862
,-5.686342,1.163393,-3.601681
,-5.686342,2.085664,-3.601681
,-5.686342,2.971562,-3.601681
,-5.686342,2.971562,-2.970138
,-5.742650,-3.996570,-2.146704
,-5.742650,-3.996570,-3.058706
,-5.742650,-3.996570,-3.648118
,-5.742650,-3.151049,-3.648118
,-5.742650,-2.252694,-3.648118
,-5.742650,-2.252694,-3.028018
,-5.742650,-2.252694,-2.146701
,-5.742650,-3.275480,-2.146701
,-5.276856,-3.689474,-1.265079
,-5.276856,-3.689474,-2.550391
,-5.276856,-3.689474,-3.305391
,-5.276856,-2.650404,-3.305391
,-5.276856,-1.371144,-3.305391
,-5.276856,-1.371144,-2.338307
,-5.276856,-1.371144,-1.265077
,-5.276856,-2.605145,-1.265077
,-2.927305,1.385822,-1.369179
,-2.927305,1.385822,-2.237458
,-2.927305,0.306890,-2.237458
,-2.912473,1.382489,0.493546
,-2.912473,1.382489,1.440029
,-2.912473,0.421053,1.440029
,-2.922828,-2.391277,0.495640
,-2.922828,-2.391277,1.442296
,-2.922828,-1.305465,1.442296
,-2.980260,-1.250667,-2.249051
,-2.980260,-2.404182,-2.249051
,-2.980260,-2.404182,-1.379770]);
			for (var i:uint = 0; i < points.length/3; i++)
			{
				goalPos.push(new Vector3D(points[3 * i + 1]*30,-points[3 * i]*30+80, -points[3 * i + 2]*30));
				//goalPos.push(new Vector3D(points[3 * i + 1]*30,-points[3 * i]*30+80, points[3 * i + 2]*30));
			}
			goalNum = goalPos.length;
			//goalPos.sortOn("y");
		}
		public override function update(items:Array,time:Number,num:uint):void 
		{
			_cur++;
			if (_cur < 10)
			{
				if (_pre) preMove(items, num, 1000);				
				return;
			}
			if (_cur<11)
			{
				for (var i:uint = 0; i < num; i++)
				{
					items[i].speed = new Vector3D();
				}
				var tem:Array = new Array();
				for (i = 0; i < num; i++)
				{
					tem.push(items[i].pos);
				}
				tem.sortOn("z", Array.NUMERIC | Array.UNIQUESORT);
				for (i = 0; i < num; i++)
				{
					items[i].pos = tem[i];
				}/**/
			}/*
			for (var j:uint = 0; j < 5; j++)
			{
				//if (j > 0) _cur++;
				if (_cur < goalNum + 10+j) 
				{
					addSpeed(items,_cur-10+j);
				}
				if (_cur >= 20+j && _cur < goalNum + 10+j) 
				{
					items[_cur-20+j].speed = new Vector3D();
				}				
			}*/
			if (_cur < 20) return;
			if (_cur < 21+goalNum/_speed) 
			{
				addSpeed(items,(_cur-20)*_speed);
			}
			if (_cur >= 30  ) 
			{
				/*for (var k:uint = 0; k < _speed; k++)
				{
					items[(_cur-30)*_speed+k].speed = new Vector3D();
				}	*/	
				var kmax:uint = (_cur - 30) * _speed ;
				var addk:uint = _speed;
				if (kmax >goalNum)
				{
					addk =  goalNum + _speed-kmax;
					kmax = goalNum;
				}
				var tspeed:Vector3D;
				var w:Number;
				var h:Number;
				if(kmax<goalNum)
					for (var k:uint = 0; k < addk; k++)
					{
						//items[(_cur - 30) * _speed + k].speed = new Vector3D();
						items[(_cur-30)*_speed+k].opos = items[(_cur-30)*_speed+k].pos.clone();
					}
				for (k=0; k < kmax; k++)
				{
					tspeed = items[k].opos.subtract(items[k].pos);
					items[k].damping = .7;
					tspeed.scaleBy(.1);
					items[k].acceleration = tspeed;
				}	/**/	
			}
		}
		
		public function addSpeed(items:Array,pcur:uint):void 
		{
			var left:uint = pcur + _speed;
			left = left > goalNum?goalNum:left;
			for (var i:uint = pcur; i < left;i++ )
			{
				var damping:Number = items[i].damping;
				damping = (1 - damping) / (1 - Math.pow(damping, 10));
				var tvc:Vector3D = goalPos[i].subtract(items[i].pos);
				tvc.scaleBy(damping);
				items[i].speed = tvc;
			}
		}
		public function preMove(items:Array,num:uint,distance:Number):void 
		{
			var tvc:Vector3D;
			var damping:Number;
			damping = .95;
			damping = (1 - damping) / (1 - Math.pow(damping, 20));
			for (var i:uint = 0; i < num; i++)
			{
				items[i].visable = true;
				tvc = MathExtend.pInRound(i, 50, distance);
				//tvc.scaleBy(.1+Math.random());
				tvc.decrementBy(items[i].pos);
				tvc.scaleBy(damping);
				items[i].speed = tvc;
			}
			this._pre = false;
		}
		
	}
	
}